/**
 * Inspired by ControllerFactory.java in Workshop 4.
 * Makes sure every controller is a singleton. 
 */

package llama.ctrl;

import java.util.HashMap;
import java.util.Map;

public class ControllerFactory {

	private final static Map<Class<? extends IController>, IController> ctrls = 
							new HashMap<Class<? extends IController>, IController>();
	
	static {
		ctrls.put(AddContactCtrl.class, new AddContactCtrl());
		ctrls.put(AssignTagsCtrl.class, new AssignTagsCtrl());
		ctrls.put(LoginClientCtrl.class, new LoginClientCtrl());
		ctrls.put(LogoutClientCtrl.class, new LogoutClientCtrl());
		ctrls.put(RemoveContactCtrl.class, new RemoveContactCtrl());
		ctrls.put(SearchUserCtrl.class, new SearchUserCtrl());
		ctrls.put(SendMessageCtrl.class, new SendMessageCtrl());
		ctrls.put(ShowContactInfoCtrl.class, new ShowContactInfoCtrl());
		ctrls.put(ConversationCtrl.class, new ConversationCtrl());
		ctrls.put(NavigationCtrl.class, new NavigationCtrl());
		ctrls.put(LoginSettingsCtrl.class, new LoginSettingsCtrl());
		ctrls.put(EditHostCtrl.class, new EditHostCtrl());
	}

	public static IController getController(Class<? extends IController> ctrl) {
		return ctrls.get(ctrl);
	}
	
}
